# Copyright 2015-2022 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Bazel build file for Pynini.

load("//third_party/bazel:cython_library.bzl", "pyx_library")

package(default_visibility = [
    "//pynini:__subpackages__",
    "//pywrapfst:__subpackages__",
])

licenses(["notice"])

cc_library(
    name = "pynini_core_cpp",
    srcs = [
        "cdrewritescript.cc",
        "concatrangescript.cc",
        "crossscript.cc",
        "defaults.cc",
        "getters.cc",
        "lenientlycomposescript.cc",
        "optimizescript.cc",
        "pathsscript.cc",
        "stringcompile.cc",
        "stringcompilescript.cc",
        "stringfile.cc",
        "stringmapscript.cc",
        "stringprintscript.cc",
        "stringutil.cc",
    ],
    hdrs = [
        "cdrewrite.h",
        "cdrewritescript.h",
        "checkprops.h",
        "concatrange.h",
        "concatrangescript.h",
        "cross.h",
        "crossscript.h",
        "defaults.h",
        "getters.h",
        "lenientlycompose.h",
        "lenientlycomposescript.h",
        "optimize.h",
        "optimizescript.h",
        "paths.h",
        "pathsscript.h",
        "prefix_tree.h",
        "stringcompile.h",
        "stringcompilescript.h",
        "stringfile.h",
        "stringmap.h",
        "stringmapscript.h",
        "stringprint.h",
        "stringprintscript.h",
        "stringutil.h",
    ],
    includes = ["."],
    visibility = ["//visibility:private"],
    deps = [
        "@com_google_absl//absl/strings",
        "@org_openfst//:far",
        "@org_openfst//:farscript",
        "@org_openfst//:fst",
        "@org_openfst//:fstscript",
        "@org_openfst//:mpdt",
        "@org_openfst//:mpdtscript",
        "@org_openfst//:pdt",
        "@org_openfst//:pdtscript",
    ],
)

pyx_library(
    name = "_pynini",
    srcs = [
        "_pynini.pyx",
        "_pywrapfst.pxd",
        "_pywrapfst.pyx",
        "cios.pxd",
        "cmemory.pxd",
        "cpynini.pxd",
        "cpywrapfst.pxd",
    ],
    deps = [":pynini_core_cpp"],
)
